
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>财富会社数码商城</title>
<link rel="stylesheet" href="/views/default/skin/default/css/index.css" />
<link rel="stylesheet" type="text/css" href="/views/default/skin/default/jquery.bxSlider/bx_styles/bx_styles.css" />
<script charset="UTF-8" src="/runtime/systemjs/jquery-1.4.4.min.js"></script>
<link rel="stylesheet" type="text/css" href="/runtime/systemjs/autovalidate/style.css"/><script charset="UTF-8" src="/runtime/systemjs/autovalidate/validate.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/form.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/artdialog/artDialog.min.js"></script>
<script type='text/javascript' src="/views/default/javascript/common.js"></script>
</head>
<body class="second" >
<div class="brand_list container_2">
	<div class="header">
		<h1 class="logo"><a title="财富会社数码商城" style="background:url(/image/logo.gif);" href="/">财富会社数码商城</a></h1>
		<ul class="shortcut">
			<li class="first"><a href="/index.php?controller=ucenter&action=index">我的账户</a></li>
			<li><a href="/index.php?controller=ucenter&action=order">我的订单</a></li>
	   		<li class='last'><a href="/index.php?controller=site&action=help_list">使用帮助</a></li>
		</ul>
				<p class="loginfo">[<a href="/index.php?controller=simple&action=login">登录</a>
						<a class="reg" href="/index.php?controller=simple&action=reg">免费注册</a>
				]</p>
	</div>

    	<div class="wrapper clearfix">
		<div class="position mt_10"> <span>您当前的位置：</span> <a href="/"> 首页</a> » 购物车</div>
		<div class="myshopping m_10">
		  <ul class="order_step">
			<li class="current"><span class="first">1、查看购物车</span></li>
			<li><span>2、填写核对订单信息</span></li>
			<li class="last"><span>3、成功提交订单</span></li>
		  </ul>
		</div>

		<div class="cart_prompt f14 t_l" style="display:none">
			<p class="m_10 gray"><b class="orange">恭喜，</b>您的订单已经满足了以下优惠活动！</p>
					</div>

		<table width="100%" class="cart_table m_10">
			<col width="115px" />
			<col />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<caption>查看购物车</caption>
			<thead>
				<tr><th>图片</th><th>商品名称</th><th>赠送积分</th><th>单价</th><th>优惠</th><th>数量</th><th>小计</th><th class="last">操作</th></tr>
			</thead>
			<tbody>
								
												<tr>
					<td><img src="/upload/2012/05/28/20120528023118499_175_175.jpg" width="66" height="66" alt="iphone4 特价限购" title="iphone4 特价限购" /></td>
					<td class="t_l">
						<a href="/index.php?controller=site&action=products&id=42" class="blue">iphone4 特价限购</a>
					</td>
					<td>0</td>
					<td>￥<b>2500.00</b></td>
					<td>减￥0</td>
					<td>
						<div class="num">
														<a class="reduce" href="javascript:void(0)" onclick='cart_reduce("goods",{"id":"42","list_img":"upload\/2012\/05\/28\/20120528023118499_175_175.jpg","sell_price":"2500.00","point":"0","weight":"0.00","store_nums":"100","exp":"0","reduce":0,"count":1,"sum":2500});'>-</a>
							<input class="tiny" value="1" onblur='cartCount("goods",{"id":"42","list_img":"upload\/2012\/05\/28\/20120528023118499_175_175.jpg","sell_price":"2500.00","point":"0","weight":"0.00","store_nums":"100","exp":"0","reduce":0,"count":1,"sum":2500});'  type="text" id="goods_count_42">
							<a class="add" href="javascript:void(0)" onclick='cart_increase("goods",{"id":"42","list_img":"upload\/2012\/05\/28\/20120528023118499_175_175.jpg","sell_price":"2500.00","point":"0","weight":"0.00","store_nums":"100","exp":"0","reduce":0,"count":1,"sum":2500});'>+</a>
						</div>
					</td>
					<td>￥<b class="red2" id="goods_sum_42">2500</b></td>
					<td><a href="/index.php?controller=simple&action=removeCart&goods_id=42&link=cart&type=goods">删除</a></td>
				</tr>
				
				<tr class="stats">
					<td colspan="8">
						<span>商品总重量：<b id='weight'>0</b>g</span><span>商品总金额：￥<b id='origin_price'>2500</b> - 商品优惠：￥<b id='discount_price'>0</b> - 促销活动优惠：￥<b id='promotion_price'>0</b></span><br />
						金额总计（不含运费）：￥<b class="orange" id='sum_price'>2500</b>
					</td>
				</tr>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="2" class="t_l">
												<a class="del" href="javascript:void(0);" onclick="delModel({msg:'确定要清空购物车么？',link:'/index.php?controller=simple&action=clearCart'});">清空购物车</a>
					</td>
					<td colspan="6" class="t_r">
												<a class="btn_continue" href="/">继续购物</a>
												<a class="btn_pay" href="javascript:check_finish();">去结算</a>
											</td>
				</tr>
			</tfoot>
		</table>

						
		
		
		
		<!--滑动门-->
		<script type="text/javascript" src="/views/default/skin/default/jquery.bxSlider/jquery.bxSlider.min.js"></script>
		<script type="text/javascript">
			jQuery(function(){
				var len = $('#scrollpic li').length > 5 ? 5 : $('#scrollpic li').length;
				$('#scrollpic').bxSlider({controls:true,displaySlideQty:len});
			});
		</script>

		
		<script type='text/javascript'>

			//购物车数量改动计算
			function cartCount(type,obj,oldCount)
			{
				var countInput    = $('#'+type+'_count_'+obj.id);
				var countInputVal = parseInt(countInput.val());

				//商品数量大于1件
				if(isNaN(countInputVal) || (countInputVal <= 0))
				{
					alert('购买的数量必须大于1件');
					countInput.val(1);
					cartCount(type,obj,oldCount);
				}

				//商品数量小于库存量
				else if(countInputVal > parseInt(obj.store_nums))
				{
					alert('购买的数量不能大于此商品的库存量');
					countInput.val(parseInt(obj.store_nums));
					cartCount(type,obj,oldCount);
				}
				else
				{
					//修改按钮状态
					countInput.attr('disabled',true);
					$('.btn_pay').val('wait');

					//获取之前的购买数量
					if(oldCount == undefined)
					{
						oldCount = countInput.data('oldCount') ? parseInt(countInput.data('oldCount')) : parseInt(obj.count);
					}

					//修改的购买数量
					var changeNum = parseInt(countInput.val()) - oldCount;

					//商品数量没有改动
					if(changeNum == 0)
					{
						//修改按钮状态
						countInput.attr('disabled',false);
						$('.btn_pay').val('ok');
						return '';
					}

					//更新购物车中此商品的数量
					var tmpUrl = '/index.php?controller=simple&action=joinCart&random=@random@';
					tmpUrl = tmpUrl.replace("@random@",Math.random());
					$.getJSON( tmpUrl ,{type:type,goods_id:obj.id,goods_num:changeNum},function(content){
						if(content.isError == true)
						{
							alert(content.message);
							var countInput = $('#'+type+'_count_'+obj.id);

							//上次数量回填
							if(changeNum < 0)
							{
								countInput.val(parseInt(countInput.val() - changeNum));
							}
							else
							{
								countInput.val(parseInt(countInput.val() + changeNum));
							}

							//修改按钮状态
							countInput.attr('disabled',false);
							$('.btn_pay').val('ok');
						}
						else
						{
							var countInput = $('#'+type+'_count_'+obj.id);

							//缓存旧的购买数量
							countInput.data('oldCount',parseInt(countInput.val()));

							/*变动的价格可能为负数(减少购买量)*/
							var smallSumC   = (mathSub(parseFloat(obj.sell_price),parseFloat(obj.reduce))) * changeNum; //价格变动
							var weightC     = mathMul(parseFloat(obj.weight),changeNum);       //重量变动
							var originC     = mathMul(parseFloat(obj.sell_price),changeNum);   //原始价格变动
							var discountC   = mathMul(parseFloat(obj.reduce),changeNum);       //优惠变动

							/*开始更新数据(1)*/

							//商品小结计算
							var smallSum    = $('#'+type+'_sum_'+obj.id);
							smallSum.html(mathAdd(parseFloat(smallSum.html()),smallSumC));

							//最终重量
							$('#weight').html(mathAdd(parseFloat($('#weight').html()),weightC));

							//原始金额
							$('#origin_price').html(mathAdd(parseFloat($('#origin_price').html()),originC));

							//优惠价
							$('#discount_price').html(mathAdd(parseFloat($('#discount_price').html()),discountC));

							//促销规则检测
							var final_sum   = mathSub(parseFloat($('#origin_price').html()),parseFloat($('#discount_price').html()));
							var tmpUrl = '/index.php?controller=simple&action=promotionRuleAjax&random=@random@';
							tmpUrl = tmpUrl.replace("@random@",Math.random());
							$.getJSON( tmpUrl ,{final_sum:final_sum},function(content){
								if(content.promotion.length > 0)
								{
									$('.cart_prompt .indent').remove();

									for(var i = 0;i < content.promotion.length; i++)
									{
										$('.cart_prompt').append('<p class="indent blue">'+content.promotion[i].plan+'，'+content.promotion[i].info+'</p>');
									}
									$('#cart_prompt').show();
								}
								else
								{
									$('.cart_prompt .indent').remove();
									$('#cart_prompt').hide();
								}
								/*开始更新数据 (2)*/

								//促销活动
								$('#promotion_price').html(content.proReduce);

								//最终金额
								$('#sum_price').html(mathSub(mathSub(parseFloat($('#origin_price').html()),parseFloat($('#discount_price').html())),parseFloat($('#promotion_price').html())));

								//修改按钮状态
								countInput.attr('disabled',false);
								$('.btn_pay').val('ok');
							});
						}
					});
				}
			}

			//增加商品数量
			function cart_increase(type,obj)
			{
				//库存超量检查
				var countInput = $('#'+type+'_count_'+obj.id);
				var oldCount   = parseInt(countInput.val());
				if(parseInt(countInput.val()) + 1 > parseInt(obj.store_nums))
				{
					alert('购买的数量大于此商品的库存量');
				}
				else
				{
					if(countInput.attr('disabled') == true)
					{
						return false;
					}
					else
					{
						countInput.attr('disabled',true);
					}
					countInput.val(parseInt(countInput.val()) + 1);
					cartCount(type,obj,oldCount);
				}
			}

			//减少商品数量
			function cart_reduce(type,obj)
			{
				//库存超量检查
				var countInput = $('#'+type+'_count_'+obj.id);
				var oldCount   = parseInt(countInput.val());
				if(parseInt(countInput.val()) - 1 <= 0)
				{
					alert('购买的数量必须大于1件');
				}
				else
				{
					if(countInput.attr('disabled') == true)
					{
						return false;
					}
					else
					{
						countInput.attr('disabled',true);
					}
					countInput.val(parseInt(countInput.val()) - 1);
					cartCount(type,obj,oldCount);
				}
			}

			//检测购买完成量
			function check_finish()
			{
				if($.trim($('.btn_pay').val()) == 'wait')
				{
					window.setInterval("check_finish()", 400);
				}
				else
				{
					window.location.href = '/index.php?controller=simple&action=cart2';
				}
			}
		</script>
	</div>


	<script language="javascript" src="http://code.54kefu.net/kefu/js/92/214092.js" charset="utf-8"></script><div class="footer"><p class="copyright"><span style="color:#333333;">Powered by </span><span style="color:#333333;">doudou37.com</span><span style="color:#333333;">&nbsp;财富会社数码城商</span></p><p><span style="color:#333333;">	Copyright&nbsp;2012&nbsp;</span> <span style="color:#333333;">财富会社数码城商</span>&nbsp;<span style="color:#333333;">&nbsp;</span><span style="color:#333333;"><a class="copyys" target="_blank" href="http://www.miibeian.gov.cn/">闽ICP备015234232号</a>   <script src="http://s16.cnzz.com/stat.php?id=4220871&amp;web_id=4220871&amp;show=pic" language="JavaScript"></script></span></p><p></p></div>
</div>
<script type='text/javascript' src='/views/default/javascript/site.js'></script>
</body>
</html>
